package com.tuzhi.base.jpa.domain;

import com.tuzhi.base.jpa.enums.SortOrderEnum;

import java.io.Serializable;

public class SortConditionBO implements Serializable {

    //属性名
    private String propertyName;
    //排序类型
    private SortOrderEnum sortOrderEnum;

    public SortConditionBO() {
    }

    public SortConditionBO(String propertyName, SortOrderEnum sortOrderEnum) {
        this.propertyName = propertyName;
        this.sortOrderEnum = sortOrderEnum;
    }

    public SortConditionBO(String propertyName, String sortOrder) {
        SortOrderEnum tmp = SortOrderEnum.ACE;
        if (SortOrderEnum.DESC.name().equalsIgnoreCase(sortOrder)) {
            tmp = SortOrderEnum.DESC;
        }
        this.propertyName = propertyName;
        this.sortOrderEnum = tmp;
    }

    public String getPropertyName() {
        return propertyName;
    }

    public void setPropertyName(String propertyName) {
        this.propertyName = propertyName;
    }

    public SortOrderEnum getSortOrderEnum() {
        return sortOrderEnum;
    }

    public void setSortOrderEnum(SortOrderEnum sortOrderEnum) {
        this.sortOrderEnum = sortOrderEnum;
    }

    @Override
    public String toString() {
        return "SortConditionBO{" +
                "propertyName='" + propertyName + '\'' +
                ", sortOrderEnum=" + sortOrderEnum +
                '}';
    }
}
